package com.pai4j.remote.aigc;

import com.pai4j.common.bean.PAIResponseBean;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "pai4j-aigc-service", contextId = "contextServiceClient")
public interface ContextServiceClient {

    @PostMapping("/aigc/context/session/create")
    PAIResponseBean<String> createSession(@RequestParam("userId") String userId,
                                          @RequestParam("botId") String botId,
                                          @RequestParam(value = "sessionId", required = false) String sessionId);

    @PostMapping("/aigc/context/session/rename")
    PAIResponseBean<Boolean> rename(@RequestParam("sessionId") String sessionId,
                                    @RequestParam("title") String title);

    @PostMapping("/aigc/context/session/close")
    PAIResponseBean<Boolean> close(@RequestParam("sessionId") String sessionId);

    @GetMapping("/aigc/context/session/list")
    PAIResponseBean<List<Map<String, Object>>> list(@RequestParam("userId") String userId,
                                                    @RequestParam(value = "botId", required = false) String botId,
                                                    @RequestParam(value = "page", required = false) Integer page,
                                                    @RequestParam(value = "size", required = false) Integer size,
                                                    @RequestParam(value = "sortField", required = false) String sortField,
                                                    @RequestParam(value = "order", required = false) String order);

    @GetMapping("/aigc/context/session/messages")
    PAIResponseBean<List<Map<String, Object>>> messages(@RequestParam("sessionId") String sessionId,
                                                        @RequestParam(value = "limit", defaultValue = "20") Integer limit);

    @GetMapping("/aigc/context/session/messages-json")
    PAIResponseBean<String> messagesJson(@RequestParam("sessionId") String sessionId,
                                         @RequestParam(value = "limit", defaultValue = "20") Integer limit);

    @PostMapping("/aigc/context/session/summarize")
    PAIResponseBean<Boolean> summarize(@RequestParam("sessionId") String sessionId);

    @GetMapping("/aigc/context/session/export")
    PAIResponseBean<List<Map<String, Object>>> export(@RequestParam("sessionId") String sessionId);

    @PostMapping("/aigc/context/message/delete")
    PAIResponseBean<Boolean> deleteMessage(@RequestParam("id") Long id);

    @PostMapping("/aigc/context/session/clear")
    PAIResponseBean<Boolean> clear(@RequestParam("sessionId") String sessionId);
}
